﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Independ.Tests
{
    static class ExAssert
    {
        public static void Throws<TException>(Action action) where TException : Exception
        {
            try
            {
                action();
                Assert.Fail("Exception of type {0} wasn't thrown.", typeof(TException).Name);
            }
            catch (TException)
            {

            }
            catch(Exception ex)
            {
                Assert.Fail("Exception of type: {0} wasn't thrown. Got exception of type {1}", typeof(TException).Name, ex.GetType().Name);
            }
        }
    }
}
